package com.pluto.dubbo.boot.consumer.controller;

import com.pluto.dubbo.boot.api.service.DemoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zy
 * @date 2019-05-21 15:55
 **/

@RequestMapping("/demo")
@RestController
public class DemoConsumerController {

    @Reference(version = "1.0.0", url = "dubbo://127.0.0.1:12345")
    private DemoService demoService;

    @GetMapping("/test")
    public Map<String,Object> test(){
        Map<String,Object> result = new HashMap<>();
        result.put("data",demoService.sayHello("Pluto"));
        return result;
    }

}
